import java.util.Scanner;

public class Caeser {

    private String alphabet;

    private int key;
    public Caeser(String alphabet, int key) {

        super();
        this.alphabet = alphabet;
        this.key = key;
    }
    public String encode(String from) {

        String to = "";
        for (int i = 0; i < from.length(); i++) {
            to += alphabet.charAt((alphabet.indexOf(from.charAt(i))+key)%alphabet.length());
        }
        return to;
    }

    public static void main(String[] args) {
        System.out.println("【凯撒密码实现】");
        Caeser caeser = new Caeser("abcdefghijklmnopqrstuvwxyz", 3);
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入待加密的字符串：");
        String str =scanner.nextLine();
        String result = caeser.encode(str);
        System.out.print(result);
    }
}